﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace WebApplication6
{
    public partial class Login : System.Web.UI.Page
    {
        SQLHelper helper = new SQLHelper();
        protected void Page_Load(object sender, EventArgs e)
        {
            
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            string name = TextBox1.Text;
            string password = TextBox2.Text;
            string sql = "select * from StudentInfo where stu_name=@name AND password=@password";
            SqlParameter[] pars =
            {
                new SqlParameter("name",name),
                new SqlParameter("password",password),
            };
            DataSet ln = helper.Get(sql, pars);
            if (ln.Tables.Count != 0)
            {
                Literal1.Text = "登陆成功";
            }
            else
            {
                Literal1.Text = "用户名或密码错误";
            }
        }
    }
}